#include "./uart.h"

static struct uart_dev_t uart1_device;
void uart_send_string(struct uart_dev_t *dev, const char *string)
{

}
void uart_send_buffer(struct uart_dev_t *dev,uint8_t *buffer, uint32_t len)
{
    uint16_t i = 0;
    for (i = 0; i < len; i++)
    {
        dev->send_byte(dev,buffer[i]);
    }
}
void uart_send_byte(struct uart_dev_t *dev,uint8_t data)
{
    dev->hal_send_byte(data);
}



int uart_init(struct uart_dev_t **dev)
{
    uart1_hal_init();
    uart1_device.send_string  = uart_send_string ;
    uart1_device.send_buffer  = uart_send_buffer ;
    uart1_device.send_byte    = uart_send_byte   ;
    uart1_device.hal_send_byte= UART1_SendByte   ;
	  *dev= &uart1_device;
	return 0;
}
